#pragma once
#include <SFML/Graphics/Drawable.hpp>
#include <nice2d/sprite.h>
#include <nice2d/metaobject.h>

class SpriteDecorator : public sf::Drawable, public Serializer
{
    DECLARE_OBJECT(SpriteDecorator)
public:
    SpriteDecorator();
    virtual ~SpriteDecorator();
public:
    void setSprite(SpritePointer sprite);
    SpriteWeakPointer getSprite()const;

    virtual void update() = 0;    
private:
    std::unique_ptr<class SpriteDecoratorData> data;
};

class SpriteImageDecorator : public SpriteDecorator
{
    DECLARE_OBJECT(SpriteImageDecorator)
public:
    SpriteImageDecorator();
    virtual ~SpriteImageDecorator();
public:
    void setImage(const std::string& file,const sf::IntRect& area);

    void setColor(const sf::Color& color);
    sf::Color getColor()const;

    void setScale(float scale);
    float getScale()const;

    void draw(sf::RenderTarget &target, sf::RenderStates states)const override;
    void update() override;
public:
    PTree serialize()override;
    void deserialize(const PTree &node)override;
private:
    std::unique_ptr<class SpriteImageDecoratorData> data;
};

/*
class SpriteRingDecorator : public SpriteDecorator
{
    DECLARE_OBJECT(SpriteRingDecorator)
public:
    SpriteRingDecorator() = delete;
    SpriteRingDecorator(SpritePointer sprite);
    ~SpriteRingDecorator();
public:
    void setScaleFactor(float factor);
    float getScaleFactor()const;

    void setOutlineThickness(float thickness);
    float getOutlineThickness()const;

    void setOutlineColor(const sf::Color &color);
    sf::Color getOutlineColor()const;

    void setFillColor(const sf::Color &color);
    sf::Color getFillColor()const;
public:
    PTree serialize()override;
    void deserialize(const PTree &node)override;
public:
    void update() override;
    void draw(sf::RenderTarget &target, sf::RenderStates states)const override;
private:
    std::unique_ptr<class SpriteRingData> data;
};

class SpriteFanShapeDecorator : public SpriteDecorator
{
    DECLARE_OBJECT(SpriteFanShapeDecorator)
public:
    SpriteFanShapeDecorator() = delete;
    SpriteFanShapeDecorator(SpritePointer sprite);
    ~SpriteFanShapeDecorator();
public:
    void setRadius(float radius);
    float getRadius()const;

    void setIncludedAngle(float angle);
    float getIncludedAngle()const;

    void setOutline(const sf::Color &color, float thickness);

    void setFillColor(const sf::Color &color);
    sf::Color getFillColor()const;
public:
    PTree serialize()override;
    void deserialize(const PTree &node)override;
public:
    void update() override;
    void draw(sf::RenderTarget &target, sf::RenderStates states) const override;
private:
    std::unique_ptr<class SpriteFanShapeDecoratorData> data;
};
*/
